From 735fd5d5b8bb3c62d5b8cee13cf55006cc4f3258 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Fri, 23 Jan 2004 20:30:32 +0000 Subject: [PATCH] bitkeeper revision 1.689 (40118468UT1zIR80oFQpa0jMSoyUvA) XenoUtil.py: Fix XenoUtil.py to import only what is necessary. --- tools/xc/py/XenoUtil.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/xc/py/XenoUtil.py b/tools/xc/py/XenoUtil.py index f17939a4a2..d038e5d204 100644 --- a/tools/xc/py/XenoUtil.py +++ b/tools/xc/py/XenoUtil.py @@ -1,4 +1,4 @@ -import string, re, os, sqlite, Xc, sys +import string, re, os, sys ##### Module variables @@ -16,6 +16,16 @@ VD_DB_FILE = "/var/spool/xen_vdisks.sqlite" """ VBD_EXPERT_MODE = 0 +##### Module initialisation + +try: + # try to import sqlite (not everyone will have it installed) + import sqlite +except ImportError: + # on failure, just catch the error, don't do anything + pass + + ##### Networking-related functions def get_current_ipaddr(dev='eth0'): @@ -808,6 +818,8 @@ def vd_extents_validate(new_extents,new_writeable): exceed VBD_EXPERT_MODE or -1 if it does (error) """ + import Xc # this is only needed in this function + xc = Xc.new() ##### Probe for explicitly created virtual disks and build a list -- 2.30.2